﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdGiRenderEnvironmentTraits : OdGiDrawableTraits
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdGiRenderEnvironmentTraits(IntPtr cPtr, bool cMemoryOwn) : base(GlobalsPINVOKE.OdGiRenderEnvironmentTraits_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdGiRenderEnvironmentTraits obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdGiRenderEnvironmentTraits()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdGiRenderEnvironmentTraits(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public new static OdGiRenderEnvironmentTraits cast(OdRxObject pObj)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGiRenderEnvironmentTraits_cast(OdRxObject.getCPtr(pObj));
			OdGiRenderEnvironmentTraits result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiRenderEnvironmentTraits)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiRenderEnvironmentTraits)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiRenderEnvironmentTraits)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdRxClass desc()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGiRenderEnvironmentTraits_desc(), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxClass isA()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGiRenderEnvironmentTraits_isA(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxObject queryX(OdRxClass protocolClass)
		{
			OdRxObject result = Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGiRenderEnvironmentTraits_queryX(this.swigCPtr, OdRxClass.getCPtr(protocolClass)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdGiRenderEnvironmentTraits createObject()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGiRenderEnvironmentTraits_createObject();
			OdGiRenderEnvironmentTraits result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiRenderEnvironmentTraits)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiRenderEnvironmentTraits)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiRenderEnvironmentTraits)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setEnable(bool bEnable)
		{
			GlobalsPINVOKE.OdGiRenderEnvironmentTraits_setEnable(this.swigCPtr, bEnable);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual bool enable()
		{
			bool result = GlobalsPINVOKE.OdGiRenderEnvironmentTraits_enable(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setIsBackground(bool bEnable)
		{
			GlobalsPINVOKE.OdGiRenderEnvironmentTraits_setIsBackground(this.swigCPtr, bEnable);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual bool isBackground()
		{
			bool result = GlobalsPINVOKE.OdGiRenderEnvironmentTraits_isBackground(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setFogColor(OdCmEntityColor color)
		{
			GlobalsPINVOKE.OdGiRenderEnvironmentTraits_setFogColor(this.swigCPtr, OdCmEntityColor.getCPtr(color));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual OdCmEntityColor fogColor()
		{
			OdCmEntityColor result = new OdCmEntityColor(GlobalsPINVOKE.OdGiRenderEnvironmentTraits_fogColor(this.swigCPtr), true);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setNearDistance(double nearDist)
		{
			GlobalsPINVOKE.OdGiRenderEnvironmentTraits_setNearDistance(this.swigCPtr, nearDist);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual double nearDistance()
		{
			double result = GlobalsPINVOKE.OdGiRenderEnvironmentTraits_nearDistance(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setFarDistance(double farDist)
		{
			GlobalsPINVOKE.OdGiRenderEnvironmentTraits_setFarDistance(this.swigCPtr, farDist);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual double farDistance()
		{
			double result = GlobalsPINVOKE.OdGiRenderEnvironmentTraits_farDistance(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setNearPercentage(double nearPct)
		{
			GlobalsPINVOKE.OdGiRenderEnvironmentTraits_setNearPercentage(this.swigCPtr, nearPct);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual double nearPercentage()
		{
			double result = GlobalsPINVOKE.OdGiRenderEnvironmentTraits_nearPercentage(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setFarPercentage(double farPct)
		{
			GlobalsPINVOKE.OdGiRenderEnvironmentTraits_setFarPercentage(this.swigCPtr, farPct);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual double farPercentage()
		{
			double result = GlobalsPINVOKE.OdGiRenderEnvironmentTraits_farPercentage(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setEnvironmentMap(OdGiMaterialTexture m)
		{
			GlobalsPINVOKE.OdGiRenderEnvironmentTraits_setEnvironmentMap(this.swigCPtr, OdGiMaterialTexture.getCPtr(m));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual OdGiMaterialTexture environmentMap()
		{
			OdGiMaterialTexture result = (OdGiMaterialTexture)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGiRenderEnvironmentTraits_environmentMap(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		private object locker = new object();

		private HandleRef swigCPtr;
	}
}
